package com.bsoft.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/*博思电子票据*/
public enum ETicketsEnum {

    //电子票据地址从系统参数中获取
    //双柏县妇幼保健院:正式
    SBXFYBJY_ORG_APPID_KEY("6684f382f04afc00013f6a2e", "36120814401607700700829194", "SBXFYBJY088155","http://192.168.149.58:10008/saas-industry/api/medical/"),
    //双柏县人民医院:正式
    SBXRMYY_ORG_APPID_KEY("6684f43ff04afc00013f6a96", "48637412470343323841627307", "SBXRMYY024345","http://192.168.149.58:10000/saas-industry/api/medical/"),
    //双柏县中医医院:正式
    SBXZYYY_ORG_APPID_KEY("6684f4a8f04afc00013f6aba", "92583493356367269648980048", "SBXZYYY941718","http://192.168.149.58:10000/saas-industry/api/medical/"),
    //玉溪市中医院:正式
    YXSZYY_ORG_APPID_KEY("674dab0fd1bf390001ffbd40", "515652bcb8ce90aa6ad864cf90", "YXSZYYY4793923",""),
    //玉溪市红塔区中医医院:正式
    YXSHTQZYY_ORG_APPID_KEY("674ff664b56a3d0001a62b59", "83940815898781138738507812", "YXSHTQZYYY677213",""),
    //新津人民医院:正式
    XJRMYY_ORG_APPID_KEY("67cb9aa524f38400011eaec6", "15042689779491579713608393", "CDSXJQRMYYCDSXJQJJZHFZX803447","http://192.168.10.168:19001/saas-industry-01/"),

    //平昌县人民医院:正式
    PCXRMYY_ORG_APPID_KEY("68400db9caaa060001b96f85", "46e41360dd9617c0e2a7e3e309", "PCXRMYY2460747",""),
    //平昌县中医院:测试
    PCXZYY_ORG_APPID_KEY("68401005caaa060001b96f9f", "37586225547759594130820758", "YYCSDW858903","");

    public static Map<String, ETicketsEnum> geteTicketMap() {
        return eTicketMap;
    }

    private final String org;
    private final String key;
    private final String appid;
    private final String pjUrl;

    public String getOrg() {
        return org;
    }

    public String getKey() {
        return key;
    }

    public String getAppid() {
        return appid;
    }

    public String getPjUrl() {
        return pjUrl;
    }

    // 静态Map用于快速查找
    private static final Map<String, ETicketsEnum> eTicketMap = new HashMap<>();

    static {
        // 初始化时填充Map
        for (ETicketsEnum ETicketsEnum : ETicketsEnum.values()) {
            eTicketMap.put(ETicketsEnum.org, ETicketsEnum);
        }
    }

    ETicketsEnum(String org, String key, String appid, String pjUrl) {
        this.org = org;
        this.key = key;
        this.appid = appid;
        this.pjUrl = pjUrl;
    }

    // 根据key获取Hospital枚举实例的name
    public static ETicketsEnum getETicketsEnumByOrg(String org) {
        ETicketsEnum ETicketsEnum = eTicketMap.get(org);
        if (ETicketsEnum != null) {
            return ETicketsEnum;
        }
        return null; // 或者抛出一个异常，取决于你的需求
    }

    public static void main(String[] args) {
        String org = "6684f43ff04afc00013f6a96";
        ETicketsEnum eTicketsEnum = ETicketsEnum.getETicketsEnumByOrg(org);

        System.out.println(eTicketsEnum.getOrg()+":::"+eTicketsEnum.getKey()+":::"+eTicketsEnum.getAppid());
    }
}
